<template>
  <div class="limits-table">
    <div class="main">
      <div class="list-herder">
        <el-page-header @back="goBack" :content="title"> </el-page-header>
      </div>
      <el-table
        :data="limitData"
        v-loading="loading"
        style="width: 100%"
        :row-style="{ height: '48px' }"
        :row-class-name="cell"
      >
        <el-table-column
          :prop="item.name"
          v-for="(item, index) in clumnData"
          :key="index"
          :label="item.lable"
          :width="item.width"
        ></el-table-column>
        <el-table-column label="开启权限" min-width="300px">
          <template slot-scope="scope">
            <el-checkbox
              v-model="scope.row.status"
              :true-label="1"
              :false-label="0"
            ></el-checkbox>
          </template>
        </el-table-column>
      </el-table>
      <div class="limit-btn">
        <el-button type="info" @click="cancelLimit">取消</el-button>
        <el-button type="primary" @click="saveLimit">保存</el-button>
      </div>
    </div>
  </div>
</template>
<script>
import { roleLimit } from "../../utils/api/role";

export default {
  name: "limitsList",
  components: {},
  porps: {
    limitData: [Array, null],
  },
  data() {
    return {
      loading: false,
      clumnData: [
        { name: "title", lable: "名称", width: 280 },
        { name: "url", lable: "路径", width: 280 },
        { name: "type", lable: "类型", width: 200 },
      ],

      title: "权限设置",
    };
  },
  methods: {
    goBack() {
      this.$router.go(-1);
    },
    cell({ row, column }) {
      if (row.type == 1) {
        return "tabheader";
      }
    },
    cancelLimit() {
      this.$router.replace("/home/role/list");
    },
    saveLimit() {},
  },
  computed: {},
  watch: {},
  created() {},
};
</script>
<style lang="less" scoped>
.limits-table {
  width: 100%;
  padding: 10px 20px;
  box-sizing: border-box;

  .main {
    width: 100%;
    background-color: #fff;
    padding: 20px 0;
    border-top: 4px solid #4091ff;
    border-bottom: 2px solid #ccc;
    border-radius: 8px 8px 0 0;
  }
  .list-herder {
    padding: 0 20px 10px;
  }
  .el-checkbox /deep/ .el-checkbox__inner {
    width: 18px;
    height: 18px;
    &::after {
      height: 10px;
      left: 6px;
      width: 4px;
    }
  }
  .el-table /deep/ .tabheader {
    background-color: #fff7d6;
    color: #333;
    &:hover {
      background-color: #e5dfd3;
    }
  }
  .limit-btn {
    padding: 20px 20px 10px;
    display: flex;
    justify-content: flex-end;
    .el-button {
      margin-left: 20px;
    }
  }
}
</style>
